/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bgu.ppm.gtm.congestion;

import bgu.ppm.gtm.base.SimpleStrategies;
import bgu.ppm.gtm.base.Strategies;
import bgu.ppm.gtm.base.str.BitmapStrategy;
import bgu.ppm.sim.api.ProblemGenerator;
import java.util.Random;

/**
 *
 * @author User
 */
public class MoreThanOneTurnProblemGenerator implements ProblemGenerator<CongestionGameModel> {

    @Override
    public CongestionGameModel generate(Random r) {
        CongestionGameModel result = new CongestionGameModel();
        result.setNumberOfAgents(2);
        result.setNumberOfResources(2);

        SimpleStrategies firstPlayerStrategies = new SimpleStrategies();
        BitmapStrategy s11 = new BitmapStrategy(2, 2, 0);
        s11.set(0, 1);
        s11.set(1, 0);
        firstPlayerStrategies.addStrategy(s11);
        BitmapStrategy s12 = new BitmapStrategy(2, 2, 0);
        s12.set(0, 0);
        s12.set(1, 1);
        firstPlayerStrategies.addStrategy(s12);

        SimpleStrategies secondPlayerStrategies = new SimpleStrategies();
        BitmapStrategy s21 = new BitmapStrategy(2, 2, 1);
        s21.set(0, 1);
        s21.set(1, 0);
        secondPlayerStrategies.addStrategy(s21);

        result.setResourcesCostFunction(new ResourcesCostFunction() {
            @Override
            public double cost(int resource, int congestion) {
                return congestion;
            }
        });

        result.setStrategies(new Strategies[]{firstPlayerStrategies, secondPlayerStrategies});

        return result;

    }
}
